package EjemplosEventosBasicos;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;


public class EjemploActionListener4 implements ActionListener{
	
	private JButton boton1,boton2;
	
	public EjemploActionListener4(JButton boton1, JButton boton2){
		this.boton1 = boton1;
		this.boton2 = boton2;
	}
	
	/*public void actionPerformed(ActionEvent e) {
		if( e.getActionCommand().equals("Boton1")){
			System.out.println("Has pulsado el boton 1");
		}else if (e.getActionCommand().equals("Boton2")){
			System.out.println("Has pulsado el boton 2");
		}
		
	}*/
	
	public void actionPerformed(ActionEvent e){
		if( e.getSource().equals(boton1)){
			System.out.println("Has pulsado el boton 1");
		}else if (e.getSource().equals(boton2)){
			System.out.println("Has pulsado el boton 2");
		}
	}

}
